//
//  FreeQuoteSucceedViewController.swift
//  koolcar
//
//  Created by kuaimaxiansheng on 2023/10/23.
//

import UIKit

class FreeQuoteSucceedViewController: BaseViewController {
     
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navBar.title = MMLocalizedString("get_ree_quote", comment: "获取免费报价")
        self.navBar.wr_setBottomLineHidden(hidden: true)
        self.view.backgroundColor = Theme.F5Color
        self.initUI()
    }
    
    func initUI(){
        
        let imgegView = UIImageView(frame: CGRect(x: (kScreenWidth - 101)/2, y: NavBarHight + 100, width: 101, height: 100))
        imgegView.image = UIImage(named: "icon_quote_succeed")
        self.view.addSubview(imgegView)
        
        let titleLab = UILabel(frame: CGRect(x: 14, y: imgegView.frame.maxY , width: kScreenWidth - 28, height: 50))
        titleLab.numberOfLines = 0
        titleLab.textColor = Theme.titleLabColor
        titleLab.font = UIFont(name: Theme.PingFangSCRegular, size: 14)
        titleLab.textAlignment = .center
        titleLab.text = MMLocalizedString("submit_successfully_hint", comment: "提交成功！我们的销售人员会尽快与您联系！")
        self.view.addSubview(titleLab)
      
        let backBtn = UIButton(frame: CGRect(x: 14, y: titleLab.frame.maxY + 20, width: kScreenWidth - 28, height: 46))
        backBtn.backgroundColor = Theme.mainColor
        backBtn.titleLabel?.font = UIFont(name: Theme.PingFangSCMedium, size: 16)
        backBtn.setTitleColor(.white, for: .normal)
        backBtn.layer.cornerRadius = 8
        backBtn.layer.masksToBounds = true
        backBtn.setTitle(MMLocalizedString("return_home", comment: "返回首页"), for: .normal)
        backBtn.addTarget(self, action: #selector(backBtnAntion), for: .touchUpInside)
        self.view.addSubview(backBtn)
        
    }

    @objc func backBtnAntion(){
        NotificationCenter.default.post(name: NSNotification.Name("freeQuoteSucceed"), object: nil)
        self.navigationController?.popToRootViewController(animated: true)
        if let tabbar = UIApplication.shared.keyWindow?.rootViewController as? BaseTabbarController {
            tabbar.selectedIndex = 0
        }
    }

}
